package cz.studio.dao;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import cz.studio.baseDao.AbstractDao;
import cz.studio.entity.Uzivatel;

public class UzivatelDao extends AbstractDao<Uzivatel, Integer> {

	public Uzivatel getUzivatel() {
		Criteria crit = hs().createCriteria(Uzivatel.class);
		crit.add(Restrictions.idEq(1));
		return (Uzivatel) crit.uniqueResult();
	}

	@SuppressWarnings("unchecked")
	public List<Uzivatel> findAll() {
		Criteria crit = hs().createCriteria(Uzivatel.class);
		return crit.list();
	}

	public Uzivatel find(Integer id) {
		Criteria crit = hs().createCriteria(Uzivatel.class);
		crit.add(Restrictions.idEq(id));
		return (Uzivatel) crit.uniqueResult();
	}
}